package com.example.ribbonconsumer.command;

import java.util.List;

import com.example.ribbonconsumer.model.User;
import com.example.ribbonconsumer.service.UserService;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

public class UserBatchCommand extends HystrixCommand<List<User>>{
	
	UserService userService;
	
	List<Long> userIds;
	
	protected UserBatchCommand(UserService userService,List<Long> userIds ) {
		super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("userServiceCommand")));
		this.userService = userService;
		this.userIds = userIds;
	}

	@Override
	protected List<User> run() throws Exception {
		return userService.findAll(userIds);
	}

}
